/**
 * File INeedDAO.java created by Pablo Díaz Fernández
 * on 06/04/2012 for the project supply-chain-simulator
 */
package org.lsk.pfc.scsim.model.persistence.dao;

import java.util.List;

import org.lsk.pfc.scsim.model.persistence.dto.NeedDTO;

/**
 * Interface to NeedDAO.
 * 
 * @author Pablo Díaz Fernández
 */
public interface INeedDAO {
	/**
	 * Retrieves the object specified by the id from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to retrieve.
	 * @return {@link NeedDTO} found or <code>null</code> if no one matches.
	 */
	NeedDTO retrieve(NeedDTO dto);

	/**
	 * Finds all object that match with the specified template.
	 * 
	 * @param dto
	 *            {@link NeedDTO} template to search.
	 * @return {@link List} of {@link NeedDTO} found.
	 */
    List<NeedDTO> list(final NeedDTO dto);

	/**
	 * Creates the {@link NeedDTO} in database or updates it if already
	 * exists.
	 * 
	 * @param dto
	 *            Object to persist.
	 * @return Object persisted.
	 */
	NeedDTO createOrUpdate(final NeedDTO dto);

	/**
	 * Deletes the object from the database.
	 * 
	 * @param dto
	 *            DTO that contains the identifier of the object to delete.
	 */
	void delete(final NeedDTO dto);
}
